<template>
  <view style="flex-direction: column; flex: 1;">
    <text v-for="(item, index) in students" @click="menuClick" :id="index" :data-name="item.name" :data-age="item.age"
      :key="index">
      {{index}} - {{item.name}} - {{item.age}}
    </text>
  </view>

</template>
<script>
  export default {
    data() {
      return {
        students: [{
            name: "张三",
            age: 18
          },
          {
            name: "李四",
            age: 20
          }
        ],
      }
    },
    methods: {
      menuClick: function(e) {
        // console.log(e);
        console.log(e.target.id);
        console.log(e.target.dataset.name);
        console.log(e.target.dataset.age);
      }
    },
  }
</script>
<style>
</style>
